package org.example.beans;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * 原型作用域Bean - 每次请求都创建新的实例
 */
@Component
@Scope("prototype")
public class PrototypeBean {
    
    private final String instanceId;
    
    public PrototypeBean() {
        this.instanceId = "PrototypeBean-" + System.currentTimeMillis() + "-" + this.hashCode();
        System.out.println("创建PrototypeBean实例: " + instanceId);
    }
    
    public String getInstanceId() {
        return instanceId;
    }
    
    public void doSomething() {
        System.out.println("PrototypeBean执行任务，实例ID: " + instanceId);
    }
} 